﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Runda.EShop.Common.Utility;
using Runda.EShop.Common.Entity;
using Runda.EShop.Bll;
using System.Data;

namespace Runda.EShop.SaaS.OrderManage
{
    public partial class ProductRegisterList : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindGrid(ConstHelper.PAGE_INIT_INDEX);
            }
        }

        private void BindGrid(int PageIndex)
        {
            List<SqlDbParameter> parms = new List<SqlDbParameter>();

            //SqlDbParameter parm = null;
            //parm = new SqlDbParameter();
            //parm.ColumnName = "[CustomerID]";
            //parm.ColumnType = DbType.Guid;
            //parm.ParameterName = "@CustomerID";
            //parm.ParameterValue = base.User.Identity.LoginUser.UserID;
            //parm.QualificationType = SqlDbParameter.QualificationSymbol.Equal;
            //parms.Add(parm);

            int RecordCount = 0;
            List<SysProductRegisterEntity> list = new OrderBll().GetAll<SysProductRegisterEntity>(parms, "CreatedAt DESC", AspNetPager1.PageSize, PageIndex, out RecordCount);

            gvOrderList.DataSource = list;
            gvOrderList.DataBind();

            AspNetPager1.RecordCount = RecordCount;
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindGrid(AspNetPager1.CurrentPageIndex);
        }
    }
}